﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.Security;
using System.Web.UI.WebControls;
using aspnetprovider.Providers;

namespace aspnetprovider.Web_Forms
{
    public partial class Register : System.Web.UI.Page
    {
        private CustomMembershipProvider MembershipProvider = new CustomMembershipProvider();
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void CreateUser_Click(object sender, EventArgs e)
        {
            try
            {
                MembershipProvider.CreateUser((string.IsNullOrEmpty(FirstName.Text) ? string.Empty : FirstName.Text).Trim(),
                                                (string.IsNullOrEmpty(MiddleName.Text) ? string.Empty : MiddleName.Text).Trim(),
                                                (string.IsNullOrEmpty(LastName.Text) ? string.Empty : LastName.Text).Trim(),
                                                (string.IsNullOrEmpty(Gender.SelectedValue) ? string.Empty : Gender.SelectedValue).Trim(),
                                                (string.IsNullOrEmpty(Email.Text) ? string.Empty : Email.Text).Trim(),
                                                (string.IsNullOrEmpty(AlterEmail.Text) ? string.Empty : AlterEmail.Text).Trim(),
                                                (string.IsNullOrEmpty(BusinessPhone.Text) ? string.Empty : BusinessPhone.Text).Trim(),
                                                (string.IsNullOrEmpty(MobilePhone.Text) ? string.Empty : MobilePhone.Text).Trim(),
                                                (string.IsNullOrEmpty(UserName.Text) ? string.Empty : UserName.Text).Trim(),
                                                (string.IsNullOrEmpty(Password.Text) ? string.Empty : Password.Text).Trim(),
                                                (string.IsNullOrEmpty(Question.Text) ? string.Empty : Question.Text).Trim(),
                                                (string.IsNullOrEmpty(Answer.Text) ? string.Empty : Answer.Text).Trim());
                FormsAuthentication.RedirectToLoginPage();
            }
            catch (Exception ex)
            {
            }
        }
    }
}